package com.heima.article.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.heima.model.article.dtos.ArticleHomeDto;
import com.heima.model.article.dtos.ArticleSimpleInfoDto;
import com.heima.model.article.pojos.ApArticle;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ApArticleMapper extends BaseMapper<ApArticle> {
    List<ApArticle> loadArticleList(@Param("dto") ArticleHomeDto dto, @Param("type") Short type);

    List<ApArticle> loadArticleForhot(@Param("dayParam") String dayParam);

    List<ArticleSimpleInfoDto> findArticleIdsByAuthorId(@Param("authorId") Long authorId);


    @Select("select count(*) from ap_article where author_id = #{id} AND (created_time BETWEEN #{startTime} AND #{endTime} )")
    int queryArticleCountById(@Param("id") Long id,
                              @Param("startTime") String startTime,
                              @Param("endTime") String endTime);
}